@echo off

set JAVAC=javac
set JAVAC_FLAGS= -source 1.3 -target 1.3

set APP_NAME=TMain
set APP_FILES=%APP_NAME%.java

set STAFF_PATH=staff
set MANIFEST_PATH=%STAFF_PATH%\Manifest.mf
set DESCRITION_PATH=%STAFF_PATH%\%APP_NAME%.jad

set BUILD_PATH=build
if not exist %BUILD_PATH% md %BUILD_PATH%

set RESULT_PATH=res
if not exist %RESULT_PATH% md %RESULT_PATH%

set JAR=jar

set WTK_PATH=C:\WTK2.5.2_01
set LIB_DIR=%WTK_PATH%\lib
set BIN_DIR=%WTK_PATH%\bin

set CLDCAPI_PATH=%LIB_DIR%\cldcapi11.jar
set MIDPAPI_PATH=%LIB_DIR%\midpapi21.jar
set JSR75PAPI_PATH=%LIB_DIR%\jsr75.jar

set CLASSES=%CLDCAPI_PATH%;%MIDPAPI_PATH%;%JSR75PAPI_PATH%

set PREVERIFY=%BIN_DIR%\preverify.exe

echo *** Compiling source files ***
%JAVAC% %JAVAC_FLAGS% -bootclasspath %CLASSES% %APP_FILES%

echo *** Preverifying class files ***
%PREVERIFY% -d %BUILD_PATH% -classpath %CLASSES% %APP_NAME%

echo *** Jaring preverified class files ***
cp %BUILD_PATH%\%APP_NAME%.class %APP_NAME%.class
%JAR% cvfm %RESULT_PATH%\%APP_NAME%.jar %MANIFEST_PATH% %APP_NAME%.class
rm %APP_NAME%.class
copy %DESCRITION_PATH% %RESULT_PATH%\%APP_NAME%.jad
